package com.hoshiicloud.mallshop.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.mallshop.feign.hystrix.ShopSaleOrderFeignServiceFallback;
import com.hoshiicloud.saleorder.entity.*;
import com.hoshiicloud.saleorder.param.OrderInfoUpdateParam;
import com.hoshiicloud.saleorder.param.OrderMainUpdateParam;
import com.hoshiicloud.saleorder.param.refund.RefundOrderListParam;
import com.hoshiicloud.saleorder.param.refund.RefundOrderPageParam;
import com.hoshiicloud.saleorder.vo.refund.RefundOrderVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 2019/8/23 11:05 qry
 */
@FeignClient(name = "hoshiicloud-sale-order", fallback = ShopSaleOrderFeignServiceFallback.class)
public interface ShopSaleOrderFeignService {

    // ----------------------------------------↓aftersale-order↓------------------------------------
    /**
     *  11:08 2019/8/9 qry
     * 退款单分页列表
     **/
    @PostMapping("/refund/refund-order/getPage")
    Response<Page<RefundOrderVo>> getRefundOrderPage(@RequestBody RefundOrderPageParam param);
    /**
     * 2019.09.02  qry
     * 自定义条件获取 退款单列表
     */
    @PostMapping("/refund/refund-order/list")
    Response<List<RefundOrderVo>> listRefundOrder(@RequestBody RefundOrderListParam param);

    /**
     * 2019.09.02  qry
     * 根据id 获取退款单信息
     */
    @GetMapping("/refund/refund-order/{id}")
    Response<RefundOrder> getRefundOrderById(@PathVariable("id") Long id);

    /**
     * 2019.09.02  qry
     * 根据id 更新退款单信息
     */
    @PutMapping("/refund/refund-order/update")
    Response<Boolean> updateRefundOrderById(@RequestBody RefundOrder entity);


    /**
     * 14:23 2019/9/2 ljx
     * 自定义条件查询退款单列表
     **/
    @PostMapping("/refund/refund-order/omniRefundOrder")
    Response<List<RefundOrder>> omniRefundOrder(@RequestBody List<OmnipotentWrapper> wrappers);
    // ----------------------------------------↑aftersale-order↑------------------------------------









    // ----------------------------------------↓consultations↓------------------------------------
    /**
     * 2019.09.02  qry
     * 根据退款单id 获取退款单的协商历史列表
     */
    @GetMapping("/refund/consultations/listByRefundId/{refundId}")
    Response<List<Consultations>> listConsultationsByRefundId(@PathVariable("refundId") Long refundId);

    /**
     *  10:46 2019/8/28 qry
     * 物理删除 退款协商历史的系统记录
     **/
    @DeleteMapping("/refund/consultations/physicsDelete/{refundId}")
    Response<Boolean> deletePhysicConsultations(@PathVariable("refundId") Long refundId);

    /**
     *  10:47 2019/8/28 qry
     * 新增协商历史记录
     **/
    @PostMapping("/refund/consultations/save")
    Response<Consultations> saveConsultations(@RequestBody Consultations entity);

    // ----------------------------------------↑consultations↑------------------------------------


















    // ----------------------------------------↓order-info↓------------------------------------
    /**
     * qry
     * 根据子订单ID查询子订单
     */
    @GetMapping("/saleorder/order-info/{id}")
    Response<OrderInfo> getOrderInfoById(@PathVariable("id")  Long id);
    /**
     * 2019.09.02  qry
     * 通过子订单ID更新子订单信息失败
     */
    @PutMapping("/saleorder/order-info/update")
    Response<Boolean> updateOrderInfoById(@RequestBody OrderInfoUpdateParam param);

    /**
     * 2019.09.02  qry
     * 通过主订单id 获取 子订单列表
     */
    @GetMapping("/saleorder/order-info/listByMainId/{mainId}")
    Response<List<OrderInfo>> listOrderInfoByMainId(@PathVariable("mainId") Long mainId);
    // ----------------------------------------↑order-info↑------------------------------------









    // ----------------------------------------↓order-main↓------------------------------------
    /**
     * 2019.09.02  qry
     * 通过主订单id  获取主订单信息
     */
    @GetMapping("/saleorder/order-main/{id}")
    Response<OrderMain> getOrderMainById(@PathVariable("id") Long id);
    /**
     * 2019.09.02  qry
     * 通过主订单id  更新主订单
     */
    @PutMapping("/saleorder/order-main/update")
    Response<Boolean> updateOrderMainById(@RequestBody OrderMainUpdateParam orderMainUpdateParam);

    /**
     * 2019.09.02  qry
     * 通过主订单id组   获取主订单列表信息
     */
    @GetMapping("/saleorder/order-main/getByIds")
    Response<List<OrderMain>> getOrderMainByIds(@RequestParam("ids") List<Long> ids);

    /**
     * 商品主单自定义查询
     * @param wrappers 查询条件
     * @return 主订单集合
     */
    @PostMapping("/saleorder/order-main/omniQueryOrderMain")
    Response<List<OrderMain>> omniQueryOrderMain(@RequestBody List<OmnipotentWrapper> wrappers);
    // ----------------------------------------↑order-main↑------------------------------------




    // ----------------------------------------↓payorder↓------------------------------------
    /**
     * 019.09.02  qry
     * 根据支付单id 获取支付信息
     */
    @GetMapping("/saleorder/payorder/{id}")
    Response<Payorder> queryPayorderById(@PathVariable("id") Long id);
    // ----------------------------------------↑payorder↑------------------------------------

}
